//
//  PeopleTopView.m
//  QT
//
//  Created by 甘世清 on 2025/1/5.
//

#import "PeopleTopView.h"
#import <BRPickerStyle.h>
@implementation PeopleTopView

- (void)SQ_UIViewForSelfView{
    self.clipsToBounds = NO;
    [self addSubview:self.cycleScrollview];
    [self addSubview:self.headerView];
    [self.cycleScrollview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self).insets(UIEdgeInsetsMake(-80, 0, 0, 0));
    }];
    [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(110);
        make.top.equalTo(self).offset(TopHeight+20);
        make.left.equalTo(self).offset(20);
    }];
    UIView * bgView = [[UIView alloc]init];
    bgView.backgroundColor = SQHexColor(@"#000000", 0.4);
    bgView.layer.cornerRadius = 20;
    bgView.layer.masksToBounds = YES;
    [self addSubview:bgView];
    [self addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headerView.mas_right).offset(20);
        make.centerY.equalTo(self.headerView);
        make.height.mas_equalTo(30);
    }];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.nameLabel).insets(UIEdgeInsetsMake(-5, -10, -5, -10));
    }];
    [self addSubview:self.bubbleView];

}
- (void)setModel:(PeopleModel *)model{
    [self.headerView.headerImage sd_setImageWithURL:SQURLImage(@"https://files-ft.oss-cn-chengdu.aliyuncs.com/file/6666cfe627349fc31fac16b2.jpg") placeholderImage:SQGetImage(@"1")];
    self.nameLabel.text = @"名字名字";
    self.cycleScrollview.imageURLStringsGroup = @[@"https://files-ft.oss-cn-chengdu.aliyuncs.com/file/6666cfe627349fc31fac16b2.jpg"];
    
    [self.bubbleView sleepTagsRefresh];
    NSMutableArray * array = [[NSMutableArray alloc]initWithObjects:@"成都市",@"32岁",@"女性",@"177天", nil];
    self.bubbleView.tagArr =  @[@[],array];
}

- (HeaderView *)headerView{
    if (!_headerView) {
        _headerView = [[HeaderView alloc]init];
        _headerView.layer.cornerRadius = 55;
        _headerView.layer.masksToBounds = YES;
        _headerView.headerImage.contentMode = UIViewContentModeScaleAspectFill;
        _headerView.layer.borderColor = UIColor.whiteColor.CGColor;
        _headerView.layer.borderWidth = 2;
    }
    return _headerView;
}
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.textColor = UIColor.whiteColor;
        _nameLabel.font = FONT_MEDIUM(20);
    }
    return _nameLabel;
}
-(SDCycleScrollView*)cycleScrollview{
    if (!_cycleScrollview) {
        _cycleScrollview = [[SDCycleScrollView alloc]initWithFrame:CGRectZero];
        _cycleScrollview.delegate = self;
        _cycleScrollview.backgroundColor = UIColor.clearColor;
        _cycleScrollview.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
        _cycleScrollview.clipsToBounds = YES;
        _cycleScrollview.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
        _cycleScrollview.pageDotColor = SQColorF5F5F5;
        _cycleScrollview.autoScrollTimeInterval = 3;
        _cycleScrollview.currentPageDotColor = SQColor333333;
        _cycleScrollview.pageControlBottomOffset = -6;
    }
    return _cycleScrollview;
}
 

- (BubbleView *)bubbleView{
    if (!_bubbleView) {
        _bubbleView = [[BubbleView alloc]initWithFrame:CGRectMake(16, 280, SCREEN_WIDETH-32, 120)];
        _bubbleView.delegate = self;
        _bubbleView.randomSpeed = 0.2;
    }
    return _bubbleView;
}
@end
